export enum NOTIFICATION_TYPE {
  SYSTEM = 'SYSTEM',
  COMMENT = 'COMMENT',
  LIKE = 'LIKE',
  ALL = 'ALL'
}

// 详细通知类型
export enum NOTIFICATION_DETAIL_TYPE {
  ATTENTION = 'attention', // 粉丝关注
  ARTICLE_AUDIT_APPROVE = 'audit_approve', // 文章审核通过
  DAILY_NEWS = 'daily_news', // 每日简报
  PASSWORD_MODIFY = 'password_modify', // 密码修改
  COMMENT_REPLY = 'comment_reply', // 回复评论
  ARTICLE_COMMENT = 'article_comment', // 文章评论
  ARTICLE_LIKE = 'article_like', // 文章点赞
  COMMENT_LIKE = 'comment_like' // 评论点赞
}

export const NOTIFICATION_DETAIL_TYPE_LIST = [
  {
    value: NOTIFICATION_DETAIL_TYPE.ATTENTION,
    label: '粉丝关注',
    category: NOTIFICATION_TYPE.SYSTEM
  },
  {
    value: NOTIFICATION_DETAIL_TYPE.ARTICLE_AUDIT_APPROVE,
    label: '文章审核通过',
    category: NOTIFICATION_TYPE.SYSTEM
  },
  {
    value: NOTIFICATION_DETAIL_TYPE.DAILY_NEWS,
    label: '每日简报',
    category: NOTIFICATION_TYPE.SYSTEM
  },
  {
    value: NOTIFICATION_DETAIL_TYPE.PASSWORD_MODIFY,
    label: '密码修改',
    category: NOTIFICATION_TYPE.SYSTEM
  },
  {
    value: NOTIFICATION_DETAIL_TYPE.COMMENT_REPLY,
    label: '回复评论',
    category: NOTIFICATION_TYPE.COMMENT
  },
  {
    value: NOTIFICATION_DETAIL_TYPE.ARTICLE_COMMENT,
    label: '文章评论',
    category: NOTIFICATION_TYPE.COMMENT
  },
  {
    value: NOTIFICATION_DETAIL_TYPE.ARTICLE_LIKE,
    label: '文章点赞',
    category: NOTIFICATION_TYPE.LIKE
  },
  {
    value: NOTIFICATION_DETAIL_TYPE.COMMENT_LIKE,
    label: '评论点赞',
    category: NOTIFICATION_TYPE.LIKE
  }
];

export const NOTIFICATION_DETAIL_TYPE_MAP = NOTIFICATION_DETAIL_TYPE_LIST.reduce(
  (acc, item) => {
    acc[item.value] = item;
    return acc;
  },
  {} as Record<string, (typeof NOTIFICATION_DETAIL_TYPE_LIST)[number]>
);

export const NOTIFICATION_TYPE_LIST = [
  {
    value: NOTIFICATION_TYPE.ALL,
    label: '全部通知'
  },
  {
    value: NOTIFICATION_TYPE.SYSTEM,
    label: '系统通知'
  },
  {
    value: NOTIFICATION_TYPE.COMMENT,
    label: '评论通知'
  },
  {
    value: NOTIFICATION_TYPE.LIKE,
    label: '点赞通知'
  }
];

export const NOTIFICATION_TYPE_MAP = NOTIFICATION_TYPE_LIST.reduce(
  (acc, item) => {
    acc[item.value] = item;
    return acc;
  },
  {} as Record<NOTIFICATION_TYPE, { value: NOTIFICATION_TYPE; label: string }>
);
